package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.moyq5.mvc.maker.test.bean.embed.TraAgentCostId;

/**
 * （用户交易）代理商手续费
 * @author Moyq5
 * @date 2018年4月26日
 */
@Entity
@Table(name = "tra_agent_cost")
@DynamicUpdate
public class TraAgentCost implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * 代理商手续费ID
	 */
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "costId", column = @Column(name = "cost_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "agentId", column = @Column(name = "agent_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "tradeId", column = @Column(name = "trade_id", nullable = false, precision = 15, scale = 0)) })
	private TraAgentCostId id;
	/**
	 * 订单
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "trade_id", nullable = false, insertable = false, updatable = false)
	private TraTrade trade;
	/**
	 * 手续费
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "cost_id", nullable = false, insertable = false, updatable = false)
	private TraCost cost;
	/**
	 * 代理商
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "agent_id", nullable = false, insertable = false, updatable = false)
	private Agent agent;
	
	/**
	 * 代理商级别
	 */
	@Column(name = "level", nullable = false, precision = 8, scale = 0)
	private Integer level;

	public TraAgentCostId getId() {
		return id;
	}

	public void setId(TraAgentCostId id) {
		this.id = id;
	}

	public TraTrade getTrade() {
		return trade;
	}

	public void setTrade(TraTrade trade) {
		this.trade = trade;
	}

	public TraCost getCost() {
		return cost;
	}

	public void setCost(TraCost cost) {
		this.cost = cost;
	}

	public Agent getAgent() {
		return agent;
	}

	public void setAgent(Agent agent) {
		this.agent = agent;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

}
